<meta http-equiv="X-UA-Compatible" content="IE=10" />
<meta content="text/html; charset=UTF-8; X-Content-Type-Options=nosniff" http-equiv="Content-Type" />

<style type="text/css">
    #homepage_user_info_win_body table td{vertical-align: top; padding-top: 10px;font-size: 12px;}
    #homepage_user_info_win_body .clearInputTextIcon{border: 1px solid #D8D8D8; border-left: none; height: 18px; line-height: 18px; float: right; width: 12px;}
    #homepage_user_info_win_body .ss_profile_line{border-top:1px solid #BFBFBF;margin-bottom:15px}

    #user_info_win_edit table tr td{width: 100px;}
    #user_info_win_edit input{border: 1px solid #D8D8D8; border-right: none; width: 298px;}

    #user_info_win_email input{width: 226px;}
    #user_info_win_email .k-input{height: 15px; line-height: 15px;}
    #user_info_win_email .k-select span{width: 14px;};
    #homepage_user_info_win_body_scroll .shareWinAColorLine{color: #63B8FF!important; text-decoration:none;}
    /*kendo upload*/
    #homepage_profile_win_select_image .k-button{min-width:0; width:45px; padding:0;margin:0;}
    #homepage_profile_win_select_image .k-upload-button{float:right;margin: 0px; min-width: 45px;}
    #homepage_profile_win_select_image .k-upload-button span{height:17px; line-height:17px; font-size:9px;}

    #homepage_profile_win_select_image .k-upload-files{clear:both; min-height:41px; padding-top:10px; display: none;}
    #homepage_profile_win_select_image .k-upload-files li{min-width:42px; max-width:42px; padding:0; border:none; float:left; margin-right:12px; font-size:12px; height:48px;}

    #homepage_profile_win_select_image .k-upload-status{left:16px; top:-3px; line-height:0;} 
    #homepage_profile_win_select_image .k-upload-status span{background:url("imgs/delete.png") no-repeat;overflow:visible; margin-left: 11px;}
    /*dataTimePicker*/
    #user_info_win_leave .k-i-calendar{width: 15px; height: 15px;}
    #user_info_win_leave .k-i-clock{width: 15px; height: 15px;}
    #user_info_win_leave .k-select{margin-top: 4px;}
	
	#smartstream_view_profile a,#smartstream_view_profile a:hover{color:inherit;text-decoration:none}
	#ss_profile_search_result_container a,#ss_profile_search_result_container a:hover{color:inherit;text-decoration:none}
	.chatlink,.chatlink:hover{color:inherit;text-decoration:none}
</style>
<style type="text/css" id="for_ipad"></style>
<link rel="stylesheet" type="text/css" href="css/smartstream.css" xmlns="http://www.w3.org/1999/html">
<script src="js/user.api.js"></script>
<div id="homepage_user_info_win_body">
    <div id="homepage_user_info_win_body_scroll" class="smartsteamTpl">
        <table id="user_info_win_display" class="wp_pl_15 wp_mr_15">
            <tr>
                <td class="wp_w_50" rowspan="6">
                    <img id="homepage_profile_user_image" data-bind="attr:{src:UserImageURL}" class="wp_w_50 wp_h_50" onerror="this.src='imgs/40.png'" src="imgs/40.png" />
                    <button id="homepage_profile_display_upload_button" type="button" class="k-button wp_w_50 wp_h_20 wp_fz_10 wp_mt_ne4">Upload</button>
                </td>
                <td class="wp_w_670">
                    <div class="wp_ml_15 wp_mt_ne2">
                        <div id="homepage_profile_dispaly_name" class="wp_fz_14" data-bind="html:Name"></div>
                        <div id="homepage_profile_dispaly_jobtitle" class="wp_mt_10" data-bind="html:JobTitle"></div>
                    </div>
                </td>
                <td valign="top">
                    <button type="button" id="homepage_profile_edit_button" class="k-button wp_w_50 wp_h_20">Edit</button>
                </td>
            </tr>
			<tr id="profile_create_chat" style="display:none">
				<td colspan="2"><a class="chatlink wp_ml_15 wp_mt_3" href="javascript:" onclick="IMNImageOnClick();return false;">
					<span>
						<img name="upi"  class="chatImg"  data-bind="attr:{onload:WorkEmail}" data-bind="attr:{sip:WorkEmail}" alt="chat" src="imgs/icons/header_win_h_10_7.png" border="0" showofflinepawn="1" />
                        chat
					</span>
						
					</a></td>
			</tr>
            <tr>
                <td colspan="2">
                    <table class="wp_ml_15" style="table-layout: fixed; width:95%;">
                        <tr>
                            <td id="homepage_profile_dispaly_nickname_label" class="wp_w_50">Nickname</td>
                            <td id="homepage_profile_dispaly_nickname" class="wp_pl_10" data-bind="text:NickName, attr:{title:NickName}" style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 304px;">
                            <!-- <td id="homepage_profile_dispaly_nickname" class="wp_pl_10">
                                <input type="text" data-bind="value:NickName, attr:{title:titleNickName}" style="width: 304px; border: 0px; background-color: #ffffff;" disabled=true /> -->
                            </td>
                        </tr>
                        <tr>
                            <td id="homepage_profile_dispaly_userid_label">User ID</td>
                            <td id="homepage_profile_dispaly_userid" class="wp_pl_10" data-bind="html:AccountName"></td>
                        </tr>
                        <tr>
                            <td id="homepage_profile_dispaly_mailing_address_label">Mailing Address</td>
                            <td id="homepage_profile_dispaly_mailing_address" class="wp_pl_10" data-bind="html:Office"></td>
                        </tr>
                        <tr>
                            <!-- <td rowspan="2">Email</td> -->
                            <td>Business Email</td>
                            <td class="wp_pl_10 wp_w_303">
                                <a id="homepage_profile_business_email_a" class="shareWinAColorLine" data-bind="html:WorkEmail, attr:{href:business_email_clicked}"></a>
                            </td>
                            <!-- <td style="width: 80px;"><span class="right">Business</span></td> -->
                        </tr>
                        <tr style="display: none;">
                            <td>Personal Email</td>
                            <td class="wp_pl_10" style="display: none;"><a href="#" class="shareWinAColorLine" data-bind="html:emailPersonal"></a></td>
                            <!-- <td style="display: none;"><span class="right">Personal</span></td> -->
                        </tr>
                        <tr>
                            <td>Phone</td>
                            <!-- <td id="homepage_profile_dispaly_business_phone_label">Business Phone</td> -->
                            <td class="wp_pl_10" style="padding-top: 0px;">
                                <table id="hp_profile_display_phone_table" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td id="hp_profile_display_business_phone"><span data-bind="html:Workphone"></td>
                                        <td id="hp_profile_display_business_phone_type" class="wp_pl_10"><span>Business</span></td>
                                    </tr>
                                    <tr>
                                        <td id="hp_profile_display_mobile_phone"><span data-bind="html:Mobilephone"></span></td>
                                        <td id="hp_profile_display_mobile_phone_type" class="wp_pl_10"><span>Mobile</span></td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr style="display: none;">
                            <td class="wp_w_109">Leave Information</td>
                            <td class="wp_pl_10" data-bind="html:leaveInfo"></td>
                        </tr>
                        <tr>
                            <td id="homepage_profile_win_tags_title_td" rowspan="2">Tags</td>
                            <td id="homepage_profile_win_tags_val_div" class="wp_pl_10" style="word-wrap:break-word;"></td>
                        </tr>
                        <tr id="homepage_profile_win_tags_new_val_tr">
                            <td class="wp_pl_10">
                                <div>
                                    <input id="homepage_profile_win_tags" type="text" style="width: 461px; border-right: none;" maxlength=255 onfocus="$(this).parent().addClass('k-state-focused')" onblur="$(this).parent().removeClass('k-state-focused')" />
                                    <button id="hp_pf_win_add_tag_btn" type="button" class="k-button wp_w_50 wp_h_20 right">Add</button>
                                    <a id="homepage_profile_dispaly_add_tags_icon" class="clearInputTextIcon" href="#" style="text-decoration:none;margin-right:10px;" onclick="$('#homepage_profile_win_tags').val('')" title="Clear">
                                        <i id="homepage_profile_dispaly_add_tags_icon_i" class="main_calendar_z_10_10"></i>
                                    </a>
                                </div>
                            </td>
                        </tr>
                        <tr style="display: none;">
                            <td>Website</td>
                            <td class="wp_pl_10"><a href="#" class="btn shareWinAColorLine" data-bind="html:website"></a></td>
                        </tr>
                        <tr style="display: none;">
                            <td>Resume/CV</td>
                            <td class="wp_pl_10"><a href="#" class="btn shareWinAColorLine" data-bind="html:resumeCV"></a></td>
                        </tr>
                        <tr style="display: none;">
                            <td>Social Networks</td>
                            <td class="wp_pl_10" data-bind="html:socialNetworks"></td>
                        </tr>
                        <tr>
                            <td id="homepage_profile_dispaly_desc_label" class="wp_w_92">About Me</td>
                            <td>
                                <div id="homepage_profile_dispaly_desc" class="wp_pl_10" data-bind="text:Aboutme"></div>
                            </td>
                        </tr>
                        <tr style="display: none;">
                            <td>Notes</td>
                            <td><div id="homepage_profile_dispaly_notes" class="wp_pl_10 wp_mb_10" data-bind="html:CurrentStatus"></div></td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
		<table id="user_info_win_edit" class="wp_pl_15 wp_mr_15">
            <tr>
                <td rowspan="8" class="wp_w_50">
                    <img id="homepage_profile_user_edit_image" data-bind="attr:{src:UserImageURL}" class="wp_w_50 wp_h_50" onerror="this.src='imgs/40.png'" src="imgs/40.png">
                    <button type="button" id="hp_pro_edit_upload_btn" class="k-button wp_w_50 wp_h_20 wp_fz_10 wp_mt_ne4">Upload</button>
                </td>
                <td rowspan="8" class="wp_w_15"></td>

                <td>
                    <table>
                        <tr>
                            <td style="padding-top: 0px">Name</td>
                            <td style="padding-top: 0px">
                                <!-- <input type="text" data-bind="value:username" disabled="true" /> -->
                                <span id="homepage_profile_edit_name" class="wp_w_311" style="display: block; word-wrap: break-word;" data-bind="html:Name"></span>
                            </td>
                        </tr>
    					<tr id="profile_edit_chat" style="display:none">
    						<td colspan="2"><a class="chatlink wp_ml_15 wp_mt_3" href="javascript:" onclick="IMNImageOnClick();return false;">
    							<span>
    								<img name="upi" height="12" class="" id="" data-bind="attr:{onload:WorkEmail}" data-bind="attr:{sip:WorkEmail}" alt="chat" src="imgs/icons/header_win_h_10_7.png" border="0" showofflinepawn="1" />
    							</span>
    							chat	
    							</a></td>
    					</tr>
                        <tr>
                            <td>Job Title</td>
                            <td>
                                <!-- <input type="text" data-bind="value:jobTitle" disabled="true" /> -->
                                <span id="homepage_profile_edit_job_title" class="wp_w_311" style="display: block; word-wrap: break-word;" data-bind="html:JobTitle"></span>
                            </td>
                        </tr>
                        <tr>
                            <td style="padding-top: 10px;">Nickname</td>
                            <td>
                                <input id="homepage_profile_win_nickname" type="text" data-bind="value:NickName" class="k-textbox wp_w_311" maxlength=255 />
                                <a id="homepage_profile_edit_clear_nickname_icon" class="clearInputTextIcon" href="#" style="text-decoration:none;" onclick="$('#homepage_profile_win_nickname').val('')" title="Clear">
                                    <i id="homepage_profile_edit_clear_nickname_icon_i" class="main_calendar_z_10_10"></i>
                                </a>
                            </td>
                        </tr>
                        <tr>
                            <td>User ID</td>
                            <td>
                                <!-- <input type="text" data-bind="value:userId" disabled="true" /> -->
                                <span id="homepage_profile_edit_userid" class="wp_w_311" style="display: block; word-wrap: break-word;" data-bind="html:AccountName"></span>
                            </td>
                        </tr>
                        <tr>
                            <td>Mailing Address</td>
                            <td>
                                <span id="homepage_profile_edit_mailing_address" class="wp_w_311" style="display: block; word-wrap: break-word;" data-bind="html:Office"></span>
                                <!-- <textarea rows="2" style="resize: none;" data-bind="html:mailingAddress" disabled="true"></textarea> -->
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <!-- email -->
            <tr>
                <td style="padding-top: 0px">
                    <table id="user_info_win_email">
                        <tr>
                            <td>Business Email</td>
                            <td style="width: 306px">
                                <a id="homepage_profile_edit_business_email" class="shareWinAColorLine" data-bind="html:WorkEmail, attr:{href:business_email_clicked}"></a>
                                <!-- <input type="text" data-bind="value:WorkEmail" disabled="true" /> -->
                                <!-- <span class="wp_w_226" data-bind="html:WorkEmail"></span>  -->
                            </td>
                            <!-- <td style="width: 80px;padding-left: 3px;">
                                <span id="user_info_win_email_type1" class="right">Business</span>
                            </td> -->
                        </tr>
                        <!-- <tr>
                            <td style="display: none;"><input type="text" data-bind="value:emailPersonal" /></td>
                            <td style="width: 80px;padding-left: 3px;display: none;"><span id="user_info_win_email_type2" class="wp_w_80"></span></td>
                        </tr> -->
                        <tr>
                            <td>Business Phone</td>
                            <td>
                                <!-- <input type="text" data-bind="value:Workphone" disabled="true" /> -->
                                <span id="homepage_profile_edit_business_phone" class="wp_w_306" data-bind="html:Workphone"></span>
                            </td>
                            <!-- <td style="width: 80px;padding-left: 3px;">
                                <span id="user_info_win_phone_type1" class="right">Business</span>
                            </td> -->
                        </tr>
                        <tr>
                            <td>Mobile Phone</td>
                            <td>
                                <!-- <input type="text" data-bind="value:Mobilephone" disabled="true" /> -->
                                <span id="homepage_profile_edit_mobile_phone" class="wp_w_306" data-bind="html:Mobilephone"></span>
                            </td>
                            <!-- <td style="width: 80px;padding-left: 3px;">
                                <span id="user_info_win_phone_type2" class="right">Mobile</span>
                            </td> -->
                        </tr>
                        <!-- <tr style="display: none;">
                            <td><input type="text" data-bind="value:phoneHome" disabled="true" /></td>
                            <td style="width: 80px;padding-left: 3px;"><span id="user_info_win_phone_type3" class="wp_w_80"></span></td>
                        </tr> -->
                    </table>
                </td>
            </tr>
            <!-- leave -->
            <tr style="display: none;">
                <td>
                    <table id="user_info_win_leave">
                        <tr>
                            <td>Leave Information</td>
                            <td><input id="leave_info_start_date" class="wp_w_170" data-bind="value:leaveInfo" /></td>
                            <td class="wp_pl_15" style="width: 30px;">to</td>
                            <td><input id="leave_info_end_date" class="wp_w_170" /></td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td style="padding-top: 0px">
                    <table>
                        <tr>
                            <td>Tags</td>
                            <td style="width: 312px">
                                <input id="homepage_profile_win_edit_tags" type="text" data-bind="value:Tags" class="wp_w_298 wp_h_18" style="color:#333;" maxlength=255 onfocus="$(this).parent().addClass('k-state-focused')" onblur="$(this).parent().removeClass('k-state-focused')" />
                                <a id="homepage_profile_edit_clear_tags_icon" class="clearInputTextIcon" href="#" style="text-decoration:none;" onclick="$('#homepage_profile_win_edit_tags').val('')" title="Clear">
                                    <i id="homepage_profile_edit_clear_tags_icon_i" class="main_calendar_z_10_10"></i>
                                </a>
                            </td>
                        </tr>
                        <tr style="display: none;">
                            <td>Website</td>
                            <td><input type="text" data-bind="value:website" /></td>
                        </tr>
                        <tr style="display: none;">
                            <td>Resume</td>
                            <td><a href="#" class="btn shareWinAColorLine" data-bind="html:resumeCV"></a></td>
                        </tr>
                        <tr style="display: none;">
                            <td>Social Networks</td>
                            <td data-bind="html:socialNetworks"></td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td>
                    <table>
                        <tr>
                            <td>About Me</td>
                            <td><textarea id="homepage_profile_win_description" rows="2" style="resize: none; border: 1px solid #D8D8D8; color: #333" data-bind="value:Aboutme" class="wp_fz_12 wp_w_311" oninput="this.value=this.value.substr(0, 255)"></textarea>
                            <!-- <input type="text" data-bind="value:Aboutme" /></td> -->
                        </tr>
                        <tr style="display: none;">
                            <td>Notes</td>
                            <td>
                                <input id="homepage_profile_win_notes" type="text" data-bind="value:CurrentStatus" style="width: 299px;" class="k-textbox" oninput="this.value=this.value.substr(0, 3600)" />
                                <a id="homepage_profile_edit_clear_notes" class="clearInputTextIcon" href="#" style="text-decoration:none;" onclick="$('#homepage_profile_win_notes').val('')" title="Clear">
                                    <i class="main_calendar_z_10_10"></i>
                                </a>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td class="right wp_w_140 wp_mb_10">
                    <button type="button" id="homepage_profile_edit_save_btn" class="k-button wp_w_50 wp_h_20 right wp_fz_11">Save</button>
                </td>
            </tr>
        </table>
		<div id="profile_split_line" class="ss_profile_line wp_mt_10 wp_mb_5"></div>
		<div id="hp_profile_view_toolbar_div" class="ss_wrap wp_pl_15 wp_mr_15">
            <div class="ss_row wp_mt_0">
                <i title="Search" id="ss_profile_search_button" class="main_common_j_11_11 right wp_mt_5 wp_ml_20 smartsteam_clickable" onclick="homepageProfileWin.onSearchClicked();"></i>
                <button id="ss_profile_menubar_share_btn" type="button" class="k-button wp_w_45 wp_h_18 wp_fz_11 right" onclick="homepageProfileWin.onShareButtonClicked();">Share</button>
                <span id="ss_profile_menubar_time_btn" style="display: none;" class="right wp_mt_3 wp_mr_20 wp_fz_12 smartsteam_clickable" onclick="homepageProfileWin.onOrderTimeClicked();">Last Modified Time<i id="ss_profile_order_time_down" class="main_icon_f_6_8 wp_ml_3 wp_mt_3" style="display: none;"></i><i id="ss_profile_order_time_up" class="main_icon_e_6_8 wp_ml_3 wp_mt_3"></i></span>
            </div>
        </div>
        <div id="ss_profile_view">
            <div class="ss_body" id="ss_profile_search">
				<div class="wp_w_768 wp_h_30 wp_ml_12">
					<span class="left wp_ml_10 wp_mr_5 wp_fz_11 wp_mt_3">Keywords</span>
						<span class="k-textbox wp_searchbar">            
							<input id="profile_ss_search_keywords_input" maxlength=2000  onkeyup="if (event.keyCode == 13) {homepageProfileWin.doSearch();}" type="text">
							<i class="k-icon k-i-search" title="Search" onclick="homepageProfileWin.doSearch();">&nbsp;</i>
						</span>
					</span></span>
				</div>
				<hr class="apps_tools_hr wp_w_768 wp_mt_9 wp_mb_10 left">
                <div id="ss_profile_search_result_container" class="wp_w_768 wp_h_20 wp_mt_10 wp_mb-10">
                    <p class="wp_mb_10" style="font-size: 12px;">
                        <span style="color:#4BB3FC;" class="wp_h_20 wp_ml_25 smartsteam_clickable" onclick="homepageProfileWin.onBackToAllClicked();">Back to all</span>
                        <span id="profile_ss_search_count">0 Result(s) for </span>
                    </p>
                    <div id="ss_profile_search_results"></div>
                </div>
            </div>
            <div class="ss_body" id="smartstream_view_profile"></div>	
        </div>
	</div>
    <!-- user information edit -->
</div>
<div id="profile_ss_window_liked_users"></div>
<script type="text/x-kendo-template" id="profile_ss_window_tmpl_liked_users">
    <div class="wp_w_162 wp_mt_10 wp_mb_10 wp_w_354 wp_ml_15">
        <img onclick="homepageProfileWin.user_info_win_create('#:data.UserID#',true)" class="left wp_w_20 wp_h_20 wp_ss_hand" src="#:data.UserImageURL#" onerror="onDefaultThumbnailWanted(this, 'U')">
        <span onclick="homepageProfileWin.user_info_win_create('#:data.UserID#',true)" class="wp_fz_12 wp_ml_15 wp_mt_ne1 left wp_ss_hand">#:data.UserName#</span>
        <div class="clear"></div>
    </div>
</script>

<div id="homepage_user_info_select_img_win_body">
    <div id="homepage_profile_win_select_image" class="wp_mt_10 wp_ml_15 wp_mr_15">
        <input id="homepage_profile_win_select_file_name" type="text" class="wp_fz_12 wp_w_426 left" disabled="true" style="position:absolute;"  />
        <input type="file" name="files" id="homepage_profile_select_file_field" class="wp_fz_12" />
    </div>
    <div class="wp_ml_15 wp_mr_15 wp_h_40 wp_mt_45">
        <img src="" alt="" class="wp_w_40 wp_h_40">
        <button id="homepage_profile_select_img_win_upload_btn" type="button" class="k-button wp_w_50 wp_h_20 right wp_fz_11 wp_mt_20">Upload</button>
        <button id="homepage_profile_select_img_win_cancel_btn" type="button" class="btn-bf k-button wp_w_50 wp_h_20 wp_mr_20 right wp_fz_11 wp_mt_20">Cancel</button>
    </div>
</div>
<script  type="text/javascript">
    // $("#user_info_win_email_type1").kendoDropDownList({
    //     dataSource: ["Business"],//, "Personal"
    //     enable: false
    // });
    // $("#user_info_win_email_type2").kendoDropDownList({
    //     dataSource: ["Business"],//, "Personal"
    //     value: "Personal",
    //     enable: false
    // });

    // $("#user_info_win_phone_type1").kendoDropDownList({
    //     dataSource: ["Business", "Mobile"],//, "Home"
    //     enable: false
    // });
    // $("#user_info_win_phone_type2").kendoDropDownList({
    //     dataSource: ["Business", "Mobile"],//, "Home"
    //     value: "Mobile",
    //     enable: false
    // });
    // $("#user_info_win_phone_type3").kendoDropDownList({
    //     dataSource: ["Business", "Mobile"],//, "Home"
    //     value: "Home",
    //     enable: false
    // });

    // $("#leave_info_start_date").kendoDateTimePicker({format: "MM/dd/yyyy hh:mm:ss", value:new Date()});
    // $("#leave_info_end_date").kendoDateTimePicker({format: "MM/dd/yyyy hh:mm:ss", value:new Date()});

    //add scroll toolbar
    // $("#homepage_user_info_win_body_scroll").slimScroll({
    //     wheelStep : 3,
    //     height: '385px'
    // });

    //select file
</script>

<script id="smartstream_profile_Tmpl" type="text/x-kendo-template">
    <div class="ss_wrap ss_max" id="profile_#:data.NotificationId#">
        <div class="left pic">
            #if (data.EntityType != null && data.EntityType.toLowerCase() == 'update') {#
            <img id="profile_max_btn_left_img#:data.NotificationId#" style="margin-top: 2px;" src="imgs/icons/main_documents_g_20_20.png" >
            #}else{#
            <img id="profile_max_btn_left_img#:data.NotificationId#" style="height: 20px;width: 20px;margin-top: 2px;" src="#:data.EntityImageUrl#"  onerror="homepageProfileWin.default(this)" >
            #}#
        </div>
        <div class="right desc">
            <div class="ss_title">
            <p style=" margin-bottom: 8px;" class="text-overflow">
                <a id="profile_max_btn_title_#:data.NotificationId#" title="#:data.NotificationTitle#" style="font-size: 14px; color: \#000000"
                #if (!data.IsdetailPageLink || !data.EntityLinkUrl || data.EntityLinkUrl.toLowerCase() == 'null') {#
                href="javascript:homepageProfileWin.showDetailWindow('profile','#:data.NotificationId#','#:data.NotificationType#','#:data.ToId#','','')">
                #}else{#
                    href="javascript:homepageProfileWin.showDetailWindowWithURL('profile','#:data.EntityLinkUrl#','#:data.NotificationId#','#:data.NotificationType#','#:data.ToId#','#:data.CreatedDate#','')">
                #}#
             #:data.NotificationTitle#</a>
            </p>
            </div>
            <div class="ss_entity" id="profile_max_btn_text_#:data.NotificationId#">
                <p style="margin-bottom: 8px;">
					<a id="profile_max_btn_title_#:data.NotificationId#" title="#:data.NotificationText#"
					#if (!data.IsdetailPageLink || !data.EntityLinkUrl || data.EntityLinkUrl.toLowerCase() == 'null') {#
					href="javascript:homepageProfileWin.showDetailWindow('profile','#:data.NotificationId#','#:data.NotificationType#','#:data.ToId#','','')">
					#}else{#
						href="javascript:homepageProfileWin.showDetailWindowWithURL('profile','#:data.EntityLinkUrl#','#:data.NotificationId#','#:data.NotificationType#','#:data.ToId#','#:data.CreatedDate#','')">
					#}#
				 #:data.NotificationText#</a>
                </p>
                #=data.AdditionalData#
            </div>
			#var strArray = (data.Tags+'') .split(",");#
			#if (data.Tags && data.Tags.length > 0) {#
				<p class="ss_tags word-break" id="profile_max_btn_tag_#:data.NotificationId#" style="color: \#a6a6a6;margin-bottom: 8px;">
				<img src="imgs/icons/tagicon.png" class="left wp_w_10 wp_h_10 wp_mt_4 wp_mr_4">
				#for (var i = 0; i < strArray.length; i++) {#
					<span  id="profile_tags" class="wp_ss_hand" onclick='homepageProfileWin.onTagsClick("#:strArray[i]#")'>#:strArray[i]#</span>
					#if(i!=strArray.length-1){#
						,
					#}#
				#}#
				</p>
			#}#
            <div class="ss_additional">
             # for(var i = 0,_next = data.Attachments ;_next  && i < data.Attachments.length ; i++ ){ #
                <div class="at_item">
                    <a target="_blank" title="#:data.Attachments[i].Name#" onclick="FileViewer.load('#:data.Attachments[i].RefURL#','#:data.Attachments[i].Name#','#:data.Attachments[i].Type#')" >
                     #= homepageProfileWin.getAppIcon(data.Attachments[i].Type) #
                     <span>#:data.Attachments[i].Name#</span>
                     </a>
                </div>
             # } #

            # for(var i = 0,_next = data.Images ; _next && i < data.Images.length ; i++ ){ #
                <div class="at_item">
                    <a target="_blank" title="#:data.Images[i].Name#" onclick="FileViewer.load('#:data.Images[i].RefURL.split('*')[0]#','#:data.Images[i].Name#','#:data.Images[i].Type#')" >
                    <img style="height: 20px;width: 20px;" src="#:data.Images[i].RefURL.split('*')[1]#" onerror="homepageProfileWin.setDefaultIcon(this)" >
                    <span>#:data.Images[i].Name#</span>
                    </a>
                </div>
             # } #

            </div>
            <div class="ss_footer">
                <table class="left wp_h_25">
                    <tr>
                        <td class="left">
                            <img id="porfile_max_from_img_#:data.NotificationId#" class="smartsteam_clickable" style="width: 15px;height: 15px;float:left;margin-right: 5px;" src="#: data.FromImageUrl #" onerror="homepageProfileWin.toSingleImg(this)"  align="middle" onclick="homepageProfileWin.user_info_win_create('#:data.FromId#',true)">
                        </td>
                        <td class="left" style="max-width: 120px;">
                            <p id="profile_max_from_#:data.NotificationId#" style="max-width: 135px;width: auto;" class="text-overflow smartsteam_clickable" title="#: data.FromName #" onclick="homepageProfileWin.user_info_win_create('#:data.FromId#',true)">#: data.FromName #</p>
                        </td>
                        <td class="left">
                            <i class="left main_calendar_x_8_3 wp_ml_10 wp_mt_5 wp_mr_10" style="margin-top: 8px;"></i>
                        </td>
                        <td class="left">
                            <img id="profile_max_to_img_#:data.NotificationId#" class="smartsteam_clickable" style="width: 15px;height: 15px;float: left;margin-right: 5px;" src="#: data.ToImageUrl #"
                            # if(data.NotificationType == 'U'){ #
                            onerror="homepageProfileWin.toSingleImg(this)"
                            # }else{#
                            onerror="homepageProfileWin.toMultiImg(this)"
                            #}#
                            # if(data.NotificationType == 'U'){ #
                            onclick="homepageProfileWin.user_info_win_create('#:data.ToId#',true)">
                            # }else{#
                            onclick='javascript:community_profile_controller.initProfilePage(#:data.CommunityId#);'>
                            #}#
                        </td>
                        <td class="left" style="max-width: 120px;">
                            <p id="profile_max_to_#:data.NotificationId#" style="max-width: 135px; width: auto;" class="text-overflow smartsteam_clickable" title="#: data.ToName #"
                            # if(data.NotificationType == 'U'){ #
                            onclick="homepageProfileWin.user_info_win_create('#:data.ToId#',true)">
                            # }else{#
                            onclick='javascript:community_profile_controller.initProfilePage(#:data.CommunityId#);'>
                            #}#
                            #: data.ToName #</p>
                        </td>
                    </tr>
                </table>
                <div class="right wp_w_300">
                    <table>
                        <tr>
                            <td width="30px;">
                                #if(data.EnableDelete){#
                                <i id="profile_max_btn_delete_#:data.NotificationId#" class="smartsteam_clickable main_calendar_p_10_10" title="Delete" onclick="homepageProfileWin.deleteRow({'id':'#:data.NotificationId#','type':'#:data.NotificationType#','targetId':'#:data.ToId#'})"></i>
                                #}#
                            </td>
                            <td width="105px;">
                                <span style="margin-top: -2px;">#: Workport.utils.calDays(data.ServerDate,data.LastModifiedDate) #</span>
                            </td>
                            <td width="30px;">
                                <i
                                # if(data.IsSubscribed){ #
                                    class="main_calendar_t_8_8
                                    # if (data.EnableSocialFeature && data.EnableSocialFeature.Subscribe){#
                                        smartsteam_clickable
                                    #}#
                                    " title="Stop Mail Alerts"
                                # }else{ #
                                    class="main_calendar_u_8_8
                                    # if (data.EnableSocialFeature && data.EnableSocialFeature.Subscribe){#
                                        smartsteam_clickable
                                    #}#
                                    " title="Receive Mail Alerts"
                                # } #
                                #var tid = data.NotificationType.toLowerCase() == 'c'?data.CommunityId:data.FromId;#
                                status="#: data.IsSubscribed#"
                                # if (data.EnableSocialFeature && data.EnableSocialFeature.Subscribe){#
                                onclick="homepageProfileWin.subscribe(this,{'notificationId':'#:data.NotificationId#','targetId':'#:tid#','notificationType':'#:data.NotificationType#'})"
                                #}#
                                ></i>
                            </td>
                            <td width="60px;">
                                <span title="Reply" id="profile_max_btn_comment_#:data.NotificationId#"
                                  #if (data.EnableSocialFeature && data.EnableSocialFeature.Comment) {#
                                      onclick=
                                            #if (!data.IsdetailPageLink || !data.EntityLinkUrl || data.EntityLinkUrl.toLowerCase() == 'null') {#
                                                "homepageProfileWin.showDetailWindow('profile','#:data.NotificationId#','#:data.NotificationType#','#:data.ToId#','#:data.CreatedDate#','');"
                                            #}else{#
                                                "homepageProfileWin.showDetailWindowWithURL('profile','#:data.EntityLinkUrl#','#:data.NotificationId#','#:data.NotificationType#','#:data.ToId#','#:data.CreatedDate#','');"
                                            #}#
                                    class = "smartsteam_clickable"
                                    #}#
                                >
                                <i class="main_smartstream_u_8_8"></i><span class="" id="profile_max_comment_#:data.NotificationId#" style="margin-left: 0px;" title="Reply">&nbsp;(#: data.CommentCount #)</span>
                                </span>
                            </td>
                            <td width="30px;">
								<i id="profile_max_btn_share_#:data.NotificationId#"  title="Share via Email"
								#if (data.EnableSocialFeature && data.EnableSocialFeature.Share) {#
									onclick = "homepageProfileWin.onShareEamilClicked('#:data.NotificationTitle#','#:data.NotificationText#');" class="smartsteam_clickable main_calendar_v_8_8"
								#} else {# 
									  class="main_calendar_v_8_8"
								#}#
								></i>
                            </td>
                            <td width="40px;">
                                <i id="profile_max_btn_like_#:data.NotificationId#"
                                #if(data.IsLiked){#
                                class="main_smartstream_t_8_8
                                #if (data.EnableSocialFeature && data.EnableSocialFeature.Like) {#
                                smartsteam_clickable
                                #}#
                                " title="You have Liked this"
                                #}else{#
                                class="main_smartstream_w_8_8
                                #if (data.EnableSocialFeature && data.EnableSocialFeature.Like) {#
                                smartsteam_clickable
                                #}#
                                " title="Like this"
                                #}#
                                status = '#:data.IsLiked#'
                                #if (data.EnableSocialFeature && data.EnableSocialFeature.Like) {#
                                onclick="homepageProfileWin.isliked(this,{'targetId': '#:data.ToId#', 'id': '#:data.NotificationId#', 'fromId': '#:data.FromId#', 'commentId': '', 'commentedBy': '', 'type': '#:data.NotificationType#' })"

                                #}#
                                ></i>&nbsp;<span style="margin-left: 0px;">
                    #if (data.EnableSocialFeature && data.EnableSocialFeature.Like){#
                        #if (data.LikesCount != '0' ){#
                            (<a id="profile_max_btn_like_count_#:data.NotificationId#" class="likesCount smartsteam_clickable" onclick="homepageProfileWin.onLickedCountClicked(this, '#:data.NotificationId#')">#:$.trim(data.LikesCount)#</a>)
                            #} else {#
                            (<a id="profile_max_btn_like_count_#:data.NotificationId#" class="likesCount" onclick="homepageProfileWin.onLickedCountClicked(this, '#:data.NotificationId#')">#:$.trim(data.LikesCount)#</a>)
                        #}#
                    #} else {#
                                (<a id="profile_max_btn_like_count_#:data.NotificationId#" class="likesCount">#:$.trim(data.LikesCount)#</a>)
                    #}#

                    </span>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <div class="ss_row ss_line wp_mt_15 wp_mb_0" id="profile_#:data.NotificationId#_line"></div>
</script>
<script type="text/javascript">
    var homepageProfileWin = (function () {
        var userInfoWinResponseSuccessCode = ['WP1008', 'WP1001'], oldTags, userInfoDetailData, vuserID, sWinTitle, homepageProfileWinSelectedImage, homepageProfileWinNewImage, scrollBar = $("#homepage_user_info_win_body_scroll"), editDesc = $("#homepage_profile_win_description"), userImg, userEditImg, headerImg = $("#homepage_header_profileBtn img"), homepageUserInfoWin = $('#homepage_user_info_win_body'), selectImgElem = $("#homepage_user_info_select_img_win_body img"), homepageUserSelectImgWin = $('#homepage_user_info_select_img_win_body'), editButton = $("#homepage_profile_edit_button"), displayTags = $("#homepage_profile_win_tags"), editTags = $("#homepage_profile_win_edit_tags"), displayUploadBtn = $("#homepage_profile_display_upload_button"), addTagsIcon = $("#homepage_profile_win_add_tags_icon"), editUploadBtn = $("#hp_pro_edit_upload_btn"), maxTmpl = $('#smartstream_profile_Tmpl').html(), maxPageTmpl = $('#smartstream_view_profile'), minPageTmpl = $('#smartstream_min_view_profile'), searchPageTmpl = $('#ss_profile_search'), searchResultContainer = $('#ss_profile_search_result_container'), searchResultPageTmpl = $('#ss_profile_search_results'), nickNameInput = $("#homepage_profile_win_nickname"), fileName = $("#homepage_profile_win_select_file_name"), mobilePhoneTd = $("#hp_profile_display_mobile_phone"), workPhoneTd = $("#hp_profile_display_business_phone"), tagsTd = $("#homepage_profile_win_tags_val_div"), browserType = Workport.getBrowser(), displayTable = $("#user_info_win_display"), lineDiv = $("#profile_split_line"), profileViewToolbar = $("#hp_profile_view_toolbar_div"), saveLoader = new Workport.Loader(homepageUserInfoWin), saveLoaderContent = {position:'center', imgColor:'white', textCSS:{'color':'white'}, boxCSS:{'opacity':'1'}}, contactsCallBackEven;
			
		var menuItems = [];//filter items

		var _pageSize = 10,
            _offset = '' ,
            _tlatest = '',
            _latest = false,
            _filter = '0' ,
            _order='0*false',
            _displayStatus = 0,//0:min page; 1:max page; 2:search page, 3:export for community
            _next = true ,
            _prev = true,
            _insertOrder = true,
            _searchOffset = '',
            _searchKeyword = '',
			_loader = '',
            _searchCount = 0;
		
		var orderTimeLable = $('#ss_profile_menubar_time_btn'), orderTimeArrowUp = $('#ss_profile_order_time_up'), orderTimeArrowDown = $('#ss_profile_order_time_down'), 
            type2Icon = {xlsx:'main_documents_o_20_20', xls:'main_documents_o_20_20', tif:'main_documents_t_20_20', tiff:'main_documents_t_20_20', docx:'main_documents_e_20_20', doc:'main_documents_e_20_20', pdf:'main_documents_f_20_20', ppt:'main_big_k_20_20', pptx:'main_big_k_20_20', txt:'main_big_n_20_20', zip:'main_big_m_20_20'};
        var useragent = Workport.getBrowser();
        if(useragent == 'ipad'){
            editTags.css('font-size','9px');
            displayTags.css('font-size','9px');
            $('#for_ipad').append('#homepage_profile_dispaly_add_tags_icon{margin-right:17px!important;width:13px!important}');
            $('#for_ipad').append('#homepage_profile_dispaly_add_tags_icon_i{position:relative;left:2px}');
            $('#for_ipad').append('#share_body_content_to_input-list{height:150px!important}');
        }
        if(useragent == 'safari_mac'){
            $('#for_ipad').append('#homepage_profile_dispaly_add_tags_icon{margin-right:17px!important;width:13px!important}');
            $('#for_ipad').append('#homepage_profile_dispaly_add_tags_icon_i{position:relative;left:2px}');
        }
        homepageUserInfoWin.kendoWindow({width:'768px',  title: WP_USER_NAME + ' – Profile', modal: true, visible:false, resizable: false, draggable: false, actions:["Close"], 
            close:function(){
                if(useragent !='ipad'){
                    scrollBar.unbind('slimscroll');
                    scrollBar.slimScroll({ scrollTo: '0px' });
                }
				
                displayTags.val("");
                editTags.val("");
                
                addTagsIcon.unbind("click");
                tagsTd.empty();
                // addTagsIcon.removeClass("communities_c_11_11");
                // addTagsIcon.addClass("communities_a_10_10");
                userImg.attr("src", "");
                editDesc.val("");
				homepageProfileWin._loader.remove();
                if(useragent == 'ipad'){
                    $('body').unbind('touchmove');
                    homepageUserInfoWin.unbind('touchmove');
                }
            },
            open: function () {
                if(useragent == 'ipad'){
                    $('body').bind('touchmove',function(event){event.preventDefault()});
                    homepageUserInfoWin.bind('touchmove',function(event){event.stopPropagation()});
                }
                homepageUserInfoWin.prev().find("span.k-i-close").attr("id", "homepage_profile_kendo_close_icon");
                if (browserType == 'chrome') {
                    displayTags.css('width', '468');
                }
                userImg = $("#homepage_profile_user_image");
                userEditImg = $("#homepage_profile_user_edit_image");
            }
        });
		
		Workport.TagFunc.setTagsAutoComplete(displayTags,function(){saveLoader.show();},function(){saveLoader.hide();});
		Workport.TagFunc.setTagsAutoComplete(editTags,function(){saveLoader.show();},function(){saveLoader.hide();});
 
        homepageUserSelectImgWin.kendoWindow({width:'512px', height: '100px', title:'Upload photo', modal: true, visible:false, draggable: false, actions:["Close"], 
            close:function(){
                fileName.val("");
                selectImgElem.attr("src", "");
                homepageProfileWinSelectedImage = '';
            },
            open: function () {
                selectImgElem.hide();
            }
        }).data("kendoWindow").center();
        
        $("#homepage_profile_select_file_field").kendoUpload({
            localization: {
                select: "Browse"
            },
            select: function(e) {
                var shareWinFileAppointType = ".jpg.jpeg.png.gif.bmp", _elem, 
                    errMessage;
                
                //Check the file type
                if (shareWinFileAppointType.indexOf(e.files[0].extension.toLowerCase()) < 0) {
                    Workport.utils.alertMsg(sWinTitle, "The preferred dimension of the image is <40*40>. The image must be of type bmp, gif, jpg, jpeg, png.", function(_data){});
                    return;
                }
                // Check file size < 1MB
                if (e.files[0].size > (2 * 1024 * 1024)) {
                    errMessage = "The size of the image must be within 2MB.";
                    Workport.utils.alertMsg(sWinTitle, errMessage, function(_data){});
                    return;
                }
                
                fileName.val(e.files[0].name);

                _elem = $(".k-state-focused input:first");
                if (_elem.is(':hidden')) {
                    _elem.remove();
                }

                _elem = $("#homepage_profile_win_select_image ul li:last");
                if (_elem.is(':hidden')) {
                    _elem.remove();
                }

                var fileReader = new FileReader();
                fileReader.readAsDataURL(e.files[0].rawFile);
                fileReader.onload = function(e)
                {
                    homepageProfileWinNewImage = e.target.result;
                    selectImgElem.attr("src", homepageProfileWinNewImage);
                    homepageProfileWinSelectedImage = homepageProfileWinNewImage.replace(/^.*?,/,'');                
                }
                selectImgElem.show();
            }
        });

        saveLoader.setContent(homepageUserInfoWin, saveLoaderContent);

        function userInfoWinGet (data) {
            if ($.inArray(data.ResponseCode, userInfoWinResponseSuccessCode) > -1) {
                var _userData = data.UserBasicDetailsModel[0], userInfoWinViewModel;
                sWinTitle = _userData.Name + " – Profile";
				homepageUserInfoWin.userName = _userData.Name;
                homepageUserInfoWin.data("kendoWindow").title(sWinTitle);
                if (!_userData.NickName) {
                    _userData.NickName = "";
                }
                if (_userData.UserImageURL) {
                    _userData.UserImageURL = _userData.UserImageURL + "?" + Math.random();
                }
                if (!_userData.Mobilephone) {
                    mobilePhoneTd.parent().hide();
                } else {
                    mobilePhoneTd.parent().show();
                }
                if (!_userData.Workphone) {
                    workPhoneTd.parent().hide();
                } else {
                    workPhoneTd.parent().show();
                }
                userInfoWinViewModel = kendo.observable(_userData);
                userInfoWinViewModel.set('business_email_clicked', 'mailto:' + _userData.WorkEmail);

                oldTags = _userData.Tags;
                if (!oldTags) {oldTags = ''}
                if ($("#homepage_profile_win_display_tags_icon").length == 0) {
                    tagsTd.append('<img id="homepage_profile_win_display_tags_icon" src="imgs/icons/tagicon.png" class="left wp_w_10 wp_h_10 wp_mt_4">' + oldTags);
                }
                if (vuserID && vuserID.toUpperCase() != WP_USER_ID.toUpperCase()) {
                    displayUploadBtn.text(_userData.ShowNetwork);
                    if ($("#homepage_profile_win_add_tags_icon").length == 0) {
                        tagsTd.append('<img src="imgs/addTag_11x11.png" id="homepage_profile_win_add_tags_icon" class="communities_a_10_10 wp_ml_3" title="Add tag" style="cursor: pointer;">');
                        addTagsIcon = $("#homepage_profile_win_add_tags_icon");
                        addTagsIcon.off().click(function () {
                            changTagsIcon();
                        });
                    }
                } else {
                    displayUploadBtn.text("Upload");        
                }
                kendo.bind($("#homepage_user_info_win_body"), userInfoWinViewModel);

               
            } else {
                Workport.utils.alertMsg(sWinTitle, data.ResponseMessage, function(_data){});
            }
        };
      
        displayTags.blur(function () {displayTags.data('kendoAutoComplete').close(); Workport.TagFunc.stopSearchTags();});

        editTags.blur(function () {editTags.data('kendoAutoComplete').close(); Workport.TagFunc.stopSearchTags();});

        function changTagsIcon () {
            if (addTagsIcon.hasClass("communities_a_10_10")) {
                $("#homepage_profile_win_tags_new_val_tr").show();
                $("#homepage_profile_win_tags_title_td").attr("rowspan", "2");
                displayTags.focus();
                addTagsIcon.attr("title", "Cancel");
                addTagsIcon.attr("src", "imgs/closeTag_11x11.png");
            } else {
                $("#homepage_profile_win_tags_title_td").attr("rowspan", "1");
                $("#homepage_profile_win_tags_new_val_tr").hide();
                displayTags.val('');
                addTagsIcon.attr("title", "Add tag");
                addTagsIcon.attr("src", "imgs/addTag_11x11.png");
            }
            addTagsIcon.toggleClass("communities_a_10_10 communities_c_11_11");
        }

        $("#hp_pf_win_add_tag_btn").click(function () {
            var newTags = $.trim(displayTags.val()), tagsMaxLen = 255;
            if (oldTags) {tagsMaxLen = 254;}

            if (!newTags) {
                Workport.utils.showTooltip('Must input tags.', displayTags);
                return;
            } else if ((oldTags + newTags).length > tagsMaxLen) {
                Workport.utils.showTooltip('Tags must be less than <255> characters.', displayTags);
                return;
            } else if (community_profile_controller.do_check_input(newTags, 2)) {
                Workport.utils.showTooltip('The allowed characters are Alpha-numeric # @ $ % &.', displayTags);
                return;
            } else {
                if (newTags.substr(0, 1) == ",") {newTags = newTags.substr(1, newTags.length);}
                if (newTags.substr(newTags.length - 1) == ",") {newTags = newTags.substr(0, newTags.length - 1);}
                if (!newTags) {
                    Workport.utils.showTooltip('Please enter valid tags.', displayTags);
                    return;
                }
            }
            saveLoader.show();
            Workport.StreamAPI.taggingUser(function (data) {
                saveLoader.hide();
                if ($.inArray(data.ResponseCode, userInfoWinResponseSuccessCode) == -1) {
                    Workport.utils.alertMsg(sWinTitle, data.ResponseMessage, function(_data){});
                } else {
                    if (oldTags)
                        newTags = oldTags + "," + newTags;

                    changTagsIcon();
                    addTagsIcon.unbind("click");
                    tagsTd.empty();
                    tagsTd.append('<img src="imgs/icons/tagicon.png" class="left wp_w_10 wp_h_10 wp_mt_4">' + newTags + '<img src="imgs/addTag_11x11.png" id="homepage_profile_win_add_tags_icon" class="communities_a_10_10 wp_ml_3" title="Add tag" style="cursor: pointer;">');
                    addTagsIcon = $("#homepage_profile_win_add_tags_icon");
                    addTagsIcon.click(function () {
                        changTagsIcon();
                    });
                    oldTags = newTags;

                    if (newTags.length >= 254) {
                        addTagsIcon.hide();
                    } else {
                        displayTags.attr("maxlength", 254 - newTags);
                    }
                }
            }, {"userId": vuserID, "tag": newTags});
        });

        $("button.btn-bf").click(function () {homepageUserSelectImgWin.data('kendoWindow').close()});

        function headPortraitButtonClicked (buttonText) {
            if (buttonText == "Upload") {
                homepageUserSelectImgWin.data('kendoWindow').open();
            } else {
                homepageProfileWin._loader.show();
                Workport.UserAPI.followUser(function (data) {
                    homepageProfileWin._loader.hide();
                    if ($.inArray(data.ResponseCode, userInfoWinResponseSuccessCode) == -1) {
                        Workport.utils.alertMsg(sWinTitle, data.ResponseMessage, function(_data){});
                    } else {
                        if (buttonText == "Follow") {
                            Workport.utils.alertMsg(sWinTitle, 'You will now receive the updates related to ' + homepageUserInfoWin.userName + ' in your Smart Stream.', function(_data){});
                            displayUploadBtn.text("UnFollow");
                        } else {
                            Workport.utils.alertMsg(sWinTitle, 'You will no longer receive the updates related to ' + homepageUserInfoWin.userName + ' in your Smart Stream.', function(_data){});
                            displayUploadBtn.text("Follow");
                        }
                        contactsCallBackEven();                       
                    }
                }, {"userId": vuserID, "action": buttonText});
            }
        }

        displayUploadBtn.click(function() {
            headPortraitButtonClicked(displayUploadBtn.text());
        });

        editUploadBtn.click(function() {
            headPortraitButtonClicked("Upload");
        });

        editButton.click(function () {
            displayTable.hide();
            $("#user_info_win_edit").show();
        });

        $("#homepage_profile_select_img_win_upload_btn").click(function () {
            var _elem = $("#homepage_profile_win_select_image span"), imgUploadLoader = new Workport.Loader(homepageUserSelectImgWin);
            if (!homepageProfileWinSelectedImage) {
                _elem.kendoTooltip({
                    content: "Must select a picture to proceed.",
                    position: "right",
                    hide: function() {
                        _elem.data('kendoTooltip').destroy();
                    }
                });
                _elem.data('kendoTooltip').show();
                $(".k-animation-container").css("margin-left", "13px");

                return;
            }
            imgUploadLoader.setContent(homepageUserSelectImgWin, saveLoaderContent);
            imgUploadLoader.show();
            Workport.UserAPI.updateUserImage(function (data) {
                imgUploadLoader.hide();
                if ($.inArray(data.ResponseCode, userInfoWinResponseSuccessCode) == -1) {
                    Workport.utils.alertMsg(sWinTitle, data.ResponseMessage, function(_data){});
                } else {
                    homepageUserSelectImgWin.data("kendoWindow").close();
                    userImg.attr("src", homepageProfileWinNewImage);
                    headerImg.attr("src", homepageProfileWinNewImage);
                    userEditImg.attr("src", homepageProfileWinNewImage);
                }
            }, {"imageBase64":homepageProfileWinSelectedImage})
        });

        $("#homepage_profile_edit_save_btn").click(function () {
            var userInfo = {}, errFlag = false, newTag = $.trim(editTags.val());
            if (newTag) {
                if (newTag.length > 255) {
                    Workport.utils.showTooltip('Tags must be less than <255> characters.', editTags);
                    errFlag = true;
                } else if (community_profile_controller.do_check_input(newTag, 2)) {
                    Workport.utils.showTooltip('The allowed characters are Alpha-numeric # @ $ % &.', editTags);
                    errFlag = true;
                } else {
                    if (newTag.substr(0, 1) == ",") {newTag = newTag.substr(1, newTag.length);}
                    if (newTag.substr(newTag.length - 1) == ",") {newTag = newTag.substr(0, newTag.length - 1);}
                    if (!newTag) {
                        Workport.utils.showTooltip('Please enter valid tags.', editTags);
                        errFlag = true;
                    }
                }
            }
            userInfo.nickName = $.trim(nickNameInput.val());
            // if (!$.trim(userInfo.nickName)) {
            //     nickNameInput.kendoTooltip({
            //         content: "Must input nick name.",
            //         position: "right",
            //         hide: function() {
            //             nickNameInput.data('kendoTooltip').destroy();
            //         }
            //     });
            //     nickNameInput.data('kendoTooltip').show();

            //     errFlag = true;
            // }

            if (errFlag) {
                return;
            }
            userInfo.tags = newTag;
            userInfo.about = $.trim(editDesc.val());
            userInfo.status = $.trim($("#homepage_profile_win_notes").val());
            
            saveLoader.show();
            Workport.UserAPI.updateUserDetail(function (data) {
                saveLoader.hide();
                if ($.inArray(data.ResponseCode, userInfoWinResponseSuccessCode) > -1) {
                    homepageUserInfoWin.data("kendoWindow").close();
                }
            }, userInfo);
        });

		function RefreshOCSStatus() {
            $("img[name^='upi']").each(
	       		 function (i, elem) {
	       		 	if(elem.attributes.getNamedItem('sip') != null){
	       		 		var eSipId = elem.attributes.getNamedItem('sip').nodeValue;
			            var eid = elem.id;
			            IMNRC(eSipId, eid);
	       		 	}
	       	});
        }

        return {
			profileCopyURL : function(params){
				homepageProfileWin.user_info_win_create(params.userId);
			},
            user_info_win_create : function (userId, isClosed, contactsCallBack) {
				if(isClosed){
					homepageUserInfoWin.data("kendoWindow").close();
					homepageProfileWin.user_info_win_create(userId);
					return;
				}
				$('.chatImg').prop("id","user_" + userId);
				var height = Math.floor($(window).height() * 0.9) - 40, oldTagsLen;
				homepageUserInfoWin.data("kendoWindow").setOptions({
				   height: height
				});
				
				homepageUserInfoWin.data("kendoWindow").center();
				if(useragent != 'ipad'){
                    scrollBar.slimScroll({
                        wheelStep : 20,
                        height : height,
                        start : 'top',
                        disableFadeOut:true,
                        touchScrollStep : 200
                    }); 
                }
                displayTable.hide();
                lineDiv.hide();
                profileViewToolbar.hide();
                $("#user_info_win_edit").hide();
                $("#homepage_profile_win_tags_new_val_tr").hide();
                $("#homepage_profile_win_tags_title_td").removeAttr("rowspan");
                displayTags.val('');
                homepageUserInfoWin.data("kendoWindow").title('');
                vuserID = userId;
				this.userId = userId;
				searchPageTmpl.hide();
				_displayStatus = 1;
                _offset = '';
                _next = false;
                _prev = true;
                _tlatest = '';
                _latest = false;
				maxPageTmpl.off('*');
                maxPageTmpl.empty();
                homepageUserInfoWin.data("kendoWindow").center();
				homepageUserInfoWin.data("kendoWindow").open();

				homepageProfileWin._loader = new Workport.Loader(scrollBar,{position:'center',imgCSS:{'margin-top': '0px'},text:'Loading',imgColor:'black',hasMask:true,textCSS:{'color':'black'}});
				homepageProfileWin._loader.show();
                if (userId.toUpperCase() != WP_USER_ID.toUpperCase()) {
					$.when(Workport.StreamAPI.getConversationStream(null,{tid:vuserID,ispersonal:false,pageSize:_pageSize,offset:'',latest:false,filter:_filter,order:_order}),
					Workport.UserAPI.getVisitUser(null,{"userId": userId})).done(function(r1,r2){
						homepageProfileWin._loader.hide();
						var _data = $.parseJSON(r1[2].responseText);
						var data = $.parseJSON(r2[2].responseText);
						userInfoWinGet(data);
						homepageProfileWin.smartstreamInit(_data);
						editButton.hide();
						addTagsIcon.show();
						$("#profile_create_chat").show();
						$("#profile_edit_chat").show();
                
                        displayTable.show();
                        lineDiv.show();
                        profileViewToolbar.show();

                        if (data && data.UserBasicDetailsModel) {
                            if (!data.UserBasicDetailsModel[0].Tags) {data.UserBasicDetailsModel[0].Tags = ''}
                            oldTagsLen = data.UserBasicDetailsModel[0].Tags.length;
                            if (!oldTagsLen || oldTagsLen < 0) {oldTagsLen = 0;}
                            if (oldTagsLen >= 254) {
                                addTagsIcon.hide();
                            } else {
                                addTagsIcon.show();
                                oldTagsLen == 0 ? displayTags.attr("maxlength", 255) : displayTags.attr("maxlength", 254 - oldTagsLen);
                            }
                        }
					});
                } else {
					addTagsIcon.hide();
					$.when(Workport.StreamAPI.getConversationStream(null,{tid:vuserID,ispersonal:false,pageSize:_pageSize,offset:'',latest:false,filter:_filter,order:_order}),
					Workport.UserAPI.getUserDetail(null)).done(function(r1,r2){
						homepageProfileWin._loader.hide();
						var _data = $.parseJSON(r1[2].responseText);
						var data = $.parseJSON(r2[2].responseText);
						userInfoWinGet(data);
						homepageProfileWin.smartstreamInit(_data);

						editButton.show();
						// displayUploadBtn.show();
						displayUploadBtn.text("Upload");
						$("#profile_create_chat").hide();
						$("#profile_edit_chat").hide();
                        
                        displayTable.show();
                        lineDiv.show();
                        profileViewToolbar.show();
					});
                }
		
				RefreshOCSStatus();
				//homepageProfileWin.smartstreamInit();
				//Workport.LocationManager.addURL('UserProfileWindow', homepageProfileWin.profileCopyURL);
				Workport.LocationManager.setFullURL(homepageUserInfoWin.data('kendoWindow'),'UserProfileWindow', {userId:userId});

                if (contactsCallBack) {
                    contactsCallBackEven = contactsCallBack;
                }
            },
			smartstreamInit: function(_data){
				var self = this;
				if(_data && $.isArray(_data.notification)){
					self.render(_data.notification);
					if (_data.notification.length) {
						_offset = _data.notification.pop().LastModifiedDate;
					}
					if (_data.notification.length) {
						_tlatest = _data.notification.shift().LastModifiedDate;
					} else {
						_tlatest = _offset;
					}
					_next = true;
				} else {
					$('#smartstream_view_profile').css('margin-top','15px');
					var innerHtml = '<div style="text-align: center;"><span class="wp_fz_12" id="profile_no_result_max" >There are no common updates between you and ' + homepageUserInfoWin.userName + '. You can share a personal update using "Share" button.</span></div>';
					$('#smartstream_view_profile').html(innerHtml);
				}
				self.resetScroll();
				maxPageTmpl.show();
				orderTimeLable.show();
			},
			onSearchClicked : function () {
                var searchDisplay = searchPageTmpl.css('display');
				if (!searchDisplay || searchDisplay == 'block') {
                    this.onBackToAllClicked();
                    return;
                }
                $('#profile_ss_search_keywords_input').val('');
                searchResultPageTmpl.off('*');
                searchResultPageTmpl.empty();
                searchPageTmpl.show();
                searchResultContainer.hide();
                _offset = '';
                _searchKeyword = '';
                _searchCount = 0;
            },
			subscribe:function(obj,param){
                var isSubscribe = $(obj).attr('status') ;
                isSubscribe = isSubscribe == 'false' ? 'true' :'false';
                param.action = isSubscribe == 'true'? 0 : 1 ;
                Workport.StreamAPI.subscriptionMail(function(_d,_c){
                    if(_d.ResponseCode=="WP1008"){
                        $(obj).attr('status',isSubscribe);
                        $(obj).attr('class',isSubscribe == 'true'? 'main_calendar_t_8_8 smartsteam_clickable':'main_calendar_u_8_8 smartsteam_clickable');
                        $(obj).attr('title',isSubscribe == 'true'? 'Stop Mail Alerts':'Receive Mail Alerts');
                    }else{
                        Workport.utils.alertMsg("", _d.ResponseMessage, function(_data){});
                    }
                },param);
            },
			isliked:function(obj,param){
				var _self = this;
				if(this.isLiked)
					return;
				this.isLiked = true;
                var isLikeMark =  $(obj).attr('status') ;
                isLikeMark = isLikeMark == 'false' ? 'true' :'false';
                param.action = isLikeMark == 'true'? 0 : 1 ;
                Workport.StreamAPI.postLike(function(_d,_c){
					_self.isLiked = false;
                    if(_d.ResponseCode=="WP1008"){
                        $(obj).attr('status',isLikeMark);
                        $(obj).attr('class',isLikeMark == 'true'? 'main_smartstream_t_8_8 smartsteam_clickable':'main_smartstream_w_8_8 smartsteam_clickable');
                       var linksCount = $(obj).parent().find('.likesCount')[0];
						if (isLikeMark == 'true'){
							 $(obj).attr('title', 'You have Liked this');
							linksCount.innerHTML = parseInt(linksCount.innerHTML)+1;
							 $(linksCount).attr('class', 'likesCount smartsteam_clickable');
						}
						else {
							$(obj).attr('title', 'Like this');
							linksCount.innerHTML = parseInt(linksCount.innerHTML)-1;
							if(linksCount.innerHTML == 0)
								$(linksCount).removeClass('smartsteam_clickable');
						}
                       

                    }else{
                        Workport.utils.alertMsg("", _d.ResponseMessage, function(){});
                    }
                },param);
            },
			bookmark:function(obj,param){
                var isBookmark =  $(obj).attr('status') ;
                isBookmark = isBookmark == 'false' ? 'true' :'false';
                param.action = isBookmark == 'true'? 0 : 1 ;
                Workport.StreamAPI.bookmark(function(_d,_c){
                    if(_d.ResponseCode=="WP1008"){
                        $(obj).attr('status',isBookmark);
                        $(obj).attr('class',isBookmark == 'true'? 'main_smartstream_ab_8_8 smartsteam_clickable':'main_smartstream_aa_8_8 smartsteam_clickable');
                        $(obj).attr('title', isBookmark == 'true'? 'Unbookmark':'Bookmark');
                    }else{
                        Workport.utils.alertMsg("", _d.ResponseMessage, function(_data){});
                    }
                },param);
            },
			deleteRow:function(obj){
                $('#'+obj.id+',#'+obj.id+'_line').remove();
				//$('#global_alert_win').find('span.no').attr("id","smartstream_delete_msg_cancel_button");
				//$('#global_alert_win').find('p').attr("id","smartstream_delete_msg");
                Workport.utils.alertMsg("Delete",'Deleting the update will also delete all attachments associated with  the update. Are you sure you want to delete the update?',"Delete",function(_is){
                    if(_is==true){
                        Workport.StreamAPI.deleteStream(function(_d,_c){
                            if(_d) {
                                if (_d.ResponseCode == "WP1008") {
                                    $('#profile_' + obj.id).remove();
                                    $('#profile_' + obj.id + '_line').remove();
									//$('#global_alert_win').find('p').attr("id","smartstream_delete_sucess_msg");
                                    Workport.utils.alertMsg("", "Your update has been deleted successfully.", function (_data) {});
                                } else if (_d.ResponseCode == "WP1007"){
									 Workport.utils.alertMsg("", "The update cannot be deleted. A document associated with this update has been checked out.", function () {});
								}
								else {
                                    Workport.utils.alertMsg("", _d.ResponseMessage, function () {
                                });
                                }
                            }
                        },obj);
                    }
                });
            },
			onLickedCountClicked : function (element, notificationId) {
                var count = parseInt(element.innerHTML);
                if (!count || count == 0) {
                    return;
                }
				window_liked_users.data('kendoWindow').center();
                window_liked_users.data('kendoWindow').open();
                var likeUsersData={ targetId:notificationId,pageSize: 200, pageNumber: 0};
                Workport.StreamAPI.getLikeByNotify(function(result,_c){
                    if(result){
                        if(result.length > 0 && result[0].LikedUsersDetails){
                            if(result[0].LikedUsersDetails.length > 0){
								window_liked_users.data('kendoWindow').center();
                                window_liked_users.data('kendoWindow').open();
                                var data=result[0].LikedUsersDetails;
                                var tmlt = kendo.template($('#profile_ss_window_tmpl_liked_users').html(),{useWithBlock:false});
                                var arr = [];
                                $.map(data,function(_data){
                                    arr.push(tmlt(_data));
                                });
                                window_liked_users.html(arr.join(''));
                                arr.length = 0;
                                
                            }
                        }else{
                            Workport.utils.alertMsg("", "LikedUsersDetails is null.", function(_data){});
                        }
                    }else{
                        Workport.utils.alertMsg("", "Liked users list response is Null.", function(_data){});
                    }
                },likeUsersData);
            },
			onBackToAllClicked : function () {
                searchPageTmpl.hide();
                maxPageTmpl.show();
                _displayStatus = 1;
                this.maxTmp();
            },
			onOrderTimeClicked : function () {
                if (_order == '0*false') {
                    _order = '0*true';
                    orderTimeArrowUp.hide();
                    orderTimeArrowDown.show();
                } else {
                    _order = '0*false';
                    orderTimeArrowDown.hide();
                    orderTimeArrowUp.show();
                }
                searchPageTmpl.hide();
                maxPageTmpl.show();
                this.maxTmp();
            },
			render:function(_rowData){
                var rowTmpl = _displayStatus ? maxTmpl : minTmpl;
                var tmp = kendo.template($.trim(rowTmpl),{useWithBlock:false});
                var arr = new Array();
                var rowHtml;
                $.map(_rowData,function(_data){
                    arr.push(tmp(_data));
                });
                var bodyArr = ['#smartstream_min_view','#smartstream_view_profile','#ss_profile_search_results'];

                var body = bodyArr[_displayStatus];
                _insertOrder ? $(arr.join('')).appendTo(body) : $(arr.join('')).prependTo(body);
                arr.length = 0 ;
                var pageArr = [minPageTmpl, maxPageTmpl, searchResultPageTmpl];
                var page = pageArr[_displayStatus];
                //page.slimscroll({});
                if (_displayStatus == 2) {
                    searchResultPageTmpl.find('.ss_title').highlight(_searchKeyword);
                    searchResultPageTmpl.find('.ss_entity').highlight(_searchKeyword);
                }
                bodyArr.length = 0;
                pageArr.length = 0;
            },
			getAppIcon:function(type){
                var className = 'main_documents_e_20_20';
                if (type2Icon[type]) {
                    className = type2Icon[type];
                }
                return '<i class="'+className+'"></i>';
            },
			doSearch : function () {
                var self = this;
                _next = false;
                var searchBar = $('#profile_ss_search_keywords_input');
                _searchKeyword = searchBar.val();
                /*if($.trim(_searchKeyword) == "") {
                    searchBar.kendoTooltip({
                        content: 'Please input the keywords.',
                        position: "right",
                        showOn: false
                    });
                    searchBar.data('kendoTooltip').show();
                    return;
                }*/

                var searchBar_length = searchBar.kendoTooltip({
                                    content: 'Please input the keywords.',
                                    position: "right",
                                    showOn: false,
                                    show: function() {
                                            isShowUserNameInfo=true;
                                        },
                                    hide: function() {
                                            isShowUserNameInfo=false;
                                        }
                                }).data('kendoTooltip');
              
                searchBar.on('input',function(e){
                    searchBar_length.hide();
                });
                if($.trim(_searchKeyword) == "") {
                    searchBar_length.show();
					return;
                }
				maxPageTmpl.off('*');
                maxPageTmpl.empty();
                searchResultPageTmpl.off('*');
                searchResultPageTmpl.empty();
                _searchOffset = '';
                _displayStatus = 2;
                _searchCount = 0;
                var data = {key:$.param({key:_searchKeyword}).substring(4),pageSize:_pageSize,targetId:this.userId,ispersonal:true,offset : _searchOffset,sync:false};
				homepageProfileWin._loader.setOptions({imgColor:'black',text:'Loading',position:'center',hasMask:true,textCSS:{'color':'black'}});
				homepageProfileWin._loader.show();
                Workport.StreamAPI.searchStream(function(_d,_code) {
					homepageProfileWin._loader.hide();
                    if(!_d){
                        Workport.utils.alertMsg("", 'network error!', function(_data){});
                        return ;
                    }
                    if(!_d.notification){
                        searchResultContainer.show();
                        $('#profile_ss_search_count').text(' > Showing 0 result(s) for ' + _searchKeyword);
                        if (_searchCount == 0) {
                            searchResultPageTmpl.html('<p style="font-size: 12px; text-align: center;width: 768px;margin-top: 25px;">No results for <span style="color: #ff0000">'+_searchKeyword+'</span>.</p>');
							maxPageTmpl.off('*');
							maxPageTmpl.empty();
							maxPageTmpl.hide();
                        }
                    }else {
                        maxPageTmpl.off('*');
                        maxPageTmpl.empty();
                        maxPageTmpl.hide();
                        searchResultContainer.show();
                        self.render(_d.notification);
                        _searchCount += _d.notification.length;
                        _searchOffset = _d.notification.pop().LastModifiedDate;
                        $('#profile_ss_search_count').text(' > Showing ' +_searchCount + ' result(s) for ' + _searchKeyword);
                        if (_searchCount == 0) {
                            searchResultPageTmpl.html('<p style="font-size: 12px; text-align: center;width: 768px;margin-top: 25px;">No results for <span style="color: #ff0000">'+_searchKeyword+'</span>.</p>');
                        }
                        _next = true;
                    }
                }, data);
            },
			default:function(obj){
                $(obj).hide();
                $(obj).parent('.pic').css({'background':'url(imgs/img20.png)'});
            },
			setDefaultIcon:function(obj){
                $(obj).attr({'src':'imgs/img20.png'});
            },
			toSingleImg:function(obj){
                $(obj).addClass('ss_single_person_icon');
                $(obj).attr('src','imgs/UserDefault.png');
            },
			toMultiImg:function(obj){
                $(obj).addClass('ss_multi_person_icon');
                $(obj).attr('src','imgs/CommunityDefault.png');
            },
			onShareButtonClicked : function () {
                var self = this;
                var cb = function () {
                    self.doTop();
                };
				if (self.userId.toUpperCase() != WP_USER_ID.toUpperCase()){
					smartstreamShareWinFunc.share_win_create(cb,homepageUserInfoWin.userName,self.userId,"U");
				} else {
					smartstreamShareWinFunc.share_win_create(cb);
				}
            },
			onShareEamilClicked : function (title,text) {
				share_email_win.open(title,text);
			},
			onTagsClick: function(tag){
                searchResultPageTmpl.off('*');
                searchResultPageTmpl.empty();
                searchPageTmpl.show();
                searchResultContainer.hide();
                _offset = '';
//                _displayStatus = 2;
                _searchKeyword = '';
                _searchCount = 0;
				$('#profile_ss_search_keywords_input').val(tag);
				homepageProfileWin.doSearch();
			},
			doTop:function(){
				if(_displayStatus != 1){
					return;
				}
                if (!_prev) {
                    return;
                }
                var self = this;
                _insertOrder = false;
                _latest = true;
                _prev = false;
				var imgHeight = $("#user_info_win_display").height()  + 30;
				homepageProfileWin._loader.setOptions({position:'up',text:'',imgCSS:{'margin-top': imgHeight},imgColor:'black',hasMask:true});
				homepageProfileWin._loader.show();
                Workport.StreamAPI.getConversationStream(function(_data){
					homepageProfileWin._loader.hide();
					if(_data && $.isArray(_data.notification)){
						self.render(_data.notification);
						if (_data.notification.length) {
							_tlatest = _data.notification.shift().LastModifiedDate;
						} else {
							_tlatest = _offset;
						}
					}
					_prev = true;
				},{tid:vuserID,ispersonal:true,pageSize:_pageSize,offset:_tlatest,latest:true,filter:_filter,order:_order});
            },
			append:function(){
                if (!_next) {
                    return;
                }
                var self = this;
                _latest = false;
                _insertOrder = true;
                _next =false;
				homepageProfileWin._loader.reset();
				homepageProfileWin._loader.setOptions({position:'down',text:'',imgColor:'black',hasMask:true,textCSS:{'color':'black'}});
				homepageProfileWin._loader.show();
				switch (_displayStatus) {
                    case 0:
                        break;
                    case 1:
                        Workport.StreamAPI.getConversationStream(function(_data){
							homepageProfileWin._loader.hide();
							if(_data && $.isArray(_data.notification)){
								_next = true;
								 if (_data.ResponseCode == 'WP1005') {
                                    _next = false;
                                }
								self.render(_data.notification);
								if (_data.notification.length) {
									_offset = _data.notification.pop().LastModifiedDate;
								}
								
							}
							self.resetScroll();
						}, {tid:vuserID,ispersonal:true,pageSize:_pageSize,offset:_offset,latest:_latest,filter:_filter,order:_order});
                        break;
                    case 2:
                        var data = {key:_searchKeyword,pageSize:_pageSize,targetId:this.userId,ispersonal:true, offset : _searchOffset,sync:false};
                        Workport.StreamAPI.searchStream(function(_d,_code) {
							homepageProfileWin._loader.hide();
                            if(!_d){
                                Workport.utils.alertMsg("", 'network error!', function(_data){});
                                return ;
                            }
                            if(!_d.notification){

                            }else {
                                searchResultContainer.show();
                                self.render(_d.notification);
                                _searchCount += _d.notification.length;
                                _searchOffset = _d.notification.pop().LastModifiedDate;
                                $('#profile_ss_search_count').text(' > Showing ' +_searchCount + ' result(s) for ' + _searchKeyword);
                                if (_searchCount == 0) {
                                    searchResultPageTmpl.html('<p style="font-size: 12px; text-align: center;width: 768px;margin-top: 25px;">No results for <span style="color: #ff0000">'+_searchKeyword+'</span>.</p>');
                                }
                                _next = true;
                            }
                        }, data);
                        break;
                    default :
                        break;
                }
            },
			resetScroll:function(){
				var self = this;
				var height = Math.floor(document.body.scrollHeight / 100 * 90) - 20;
				if(useragent == 'ipad'){
                    scrollBar.css('overflow-y','scroll');
                    scrollBar.css('height',height-30);
                    $("#homepage_user_info_win_body_scroll").bind("scroll",function(){
                        if($("#homepage_user_info_win_body_scroll")[0].scrollTop == 0){ //top
                            self.doTop();
                        } else if($("#homepage_user_info_win_body_scroll")[0].scrollHeight <= $("#homepage_user_info_win_body_scroll")[0].scrollTop + $("#homepage_user_info_win_body_scroll").height()){ // bottom
                            self.append();
                        }
                    });
                } else{
                        scrollBar.unbind('slimscroll');
                        scrollBar.slimScroll({
                        wheelStep : 20,
                        height : height,
                        start : 'top',
                        disableFadeOut:true,
                        touchScrollStep : 200
                    });
                    scrollBar.slimScroll().bind('slimscroll',function(e,pos){
                        if('bottom' ==  pos){
                            self.append();
                        }
                        if('top' == pos){
                            self.doTop();
                        }
                    }); 
                 }
            },
			showDetailWindowWithURL :  function (source,url,notID,notType,tagID,creatDate,notText,commentListPageSize){
                var cb = function () {
                    Workport.StreamAPI.getStreamByNotify(function(_d,_code){
                        if(!_d){
                            Workport.utils.alertMsg("", 'network error!', function(_data){});
                            return ;
                        }
                        if(_d.notification==null){
                            Workport.utils.alertMsg("", "Your update has been deleted successfully.", function(_data){});
                            return;
                        }

                        var rowTmpl = maxTmpl;
                        var tmp = kendo.template($.trim(rowTmpl),{useWithBlock:false});
                        var arr = new Array();
                        $.map(_d.notification,function(_data){
                            arr.push(tmp(_data));
                        });
                        var prex = ['max_', 'max_', 'max_'];
                        var line = $('#profile_' + prex[_displayStatus] + notID + '_line');
                        line.remove();
                        var body = $('#profile_' + prex[_displayStatus] + notID);
                        body.replaceWith(arr.join(''));
						if (_displayStatus == 2) {
							searchResultPageTmpl.find('.ss_title').highlight(_searchKeyword);
							searchResultPageTmpl.find('.ss_entity').highlight(_searchKeyword);
						}
                    },{ notificationId:notID,type: notType, targetId: tagID,sync:false,source:source});//true
                };
                show_ss_topic_detail_win_with_iframe(source,url, notID,notType,tagID,creatDate,notText,commentListPageSize,cb);
            },
            showDetailWindow : function (source,notID,notType,tagID,creatDate,notText,commentListPageSize){
                var cb = function () {
                    Workport.StreamAPI.getStreamByNotify(function(_d,_code){
                        if(!_d){
                            Workport.utils.alertMsg("", 'network error!', function(_data){});
                            return ;
                        }
                        if(_d.notification==null){
                            Workport.utils.alertMsg("", "Your update has been deleted successfully.", function(_data){});
                            return;
                        }

                        var rowTmpl = maxTmpl;
                        var tmp = kendo.template($.trim(rowTmpl),{useWithBlock:false});
                        var arr = new Array();
                        $.map(_d.notification,function(_data){
                            arr.push(tmp(_data));
                        });
        
                        var line = $('#profile_' + notID + '_line');
                        line.remove();
                        var body = $('#profile_' + notID);
                        body.replaceWith(arr.join(''));
						if (_displayStatus == 2) {
							searchResultPageTmpl.find('.ss_title').highlight(_searchKeyword);
							searchResultPageTmpl.find('.ss_entity').highlight(_searchKeyword);
						}
                    },{ notificationId:notID,type: notType, targetId: tagID,sync:false,source:source});//true
                };
                show_ss_topic_detail_win(source,notID,notType,tagID,creatDate,notText,commentListPageSize, cb);
            },
			maxTmp:function(){
                var self = this;
                _displayStatus = 1;
                _offset = '';
                _next = false;
                _prev = true;
                _tlatest = '';
                _latest = false;
				maxPageTmpl.off('*');
                maxPageTmpl.empty();
				homepageProfileWin._loader.setOptions({imgColor:'black',text:'Loading',position:'center',hasMask:true,textCSS:{'color':'black'}});
				homepageProfileWin._loader.show();
				Workport.StreamAPI.getConversationStream(function(_data){
					homepageProfileWin._loader.hide();
					if(_data && $.isArray(_data.notification)){
                        self.render(_data.notification);
                        if (_data.notification.length) {
                            _offset = _data.notification.pop().LastModifiedDate;
                        }
                        if (_data.notification.length) {
                            _tlatest = _data.notification.shift().LastModifiedDate;
                        } else {
                            _tlatest = _offset;
                        }
                        _next = true;
                    } else {
                       /* if (_displayStatus == 0 && !_offset && _filter == '0' && _tlatest == '') {
                            $('#smartstream_max_view').html('<div id="smartstream_max_began" style="margin-left: 15px;"><img src="imgs/beganSmartSream.png"></div>');
                            $('#smartstream_max_view').css('margin-top','0px');
                        } else {
                            $('#smartstream_max_view').css('margin-top','15px');
							var innerHtml = '<div style="text-align: center;"><span id="smartstream_no_result_max" >No results found for the selected filter criteria.</span></div>';
							$('#smartstream_max_view').html(innerHtml);
                        }
						*/
						$('#smartstream_view_profile').css('margin-top','15px');
						var innerHtml = '<div style="text-align: center;"><span class="wp_fz_12" id="profile_no_result_max" >There are no common updates between you and ' + homepageUserInfoWin.userName + '. You can share a personal update using "Share" button.</span></div>';
						$('#smartstream_view_profile').html(innerHtml);
                    }
					self.resetScroll();
                },{tid:vuserID,ispersonal:false,pageSize:_pageSize,offset:'',latest:false,filter:_filter,order:_order});
				maxPageTmpl.show();
				orderTimeLable.show();
            },
        };        
    })();
    Workport.LocationManager.addURL('UserProfileWindow', homepageProfileWin.profileCopyURL);
    $('#homepage_header_profileBtn').on({
        click:function(e){
            homepageProfileWin.user_info_win_create(WP_USER_ID);
        }
    });
</script>